package com.study.easyexcel.common.domain;

import com.alibaba.excel.write.handler.CellWriteHandler;

import java.util.List;

/**
 * @author yuhuan
 * @date 2024/1/3
 */
public class ListBodyStyleMap<T> {

    /**
     * 数据体的前缀
     */
    private final String listPrefix;

    /**
     * 排序编号，为了保证样式处理器的准确性。因为样式处理器是通过行索引来定位单元格，一旦数据填充顺序错误，也会
     * 导致行索引错误，样式处理器就无法准确定位单元格
     */
    private final Integer sorted;

    /**
     * 工作溥的列表数据体
     */
    private List<T> dataBody;

    /**
     * 单元格的样式处理器
     */
    private CellWriteHandler handlers;

    public ListBodyStyleMap(String prefix, List<T> data, Integer sortNum) {
        this.dataBody = data;
        this.listPrefix = prefix;
        this.sorted = sortNum;
    }

    public void setHandlers(CellWriteHandler handlers) {
        this.handlers = handlers;
    }

    public CellWriteHandler getHandlers() {
        return handlers;
    }

    public List<T> getDataBody() {
        return dataBody;
    }

    public String getListPrefix() {
        return listPrefix;
    }

    public Integer getSorted() {
        return sorted;
    }

    public void setDataBody(List<T> dataBody) {
        this.dataBody = dataBody;
    }
}
